//////////////////////////////////////////////////////////////////////////////////////////////
//	File			:	"Entity.h"
//
//	Author			:	Mike Davis, Matt Stover, James Thornton, Keith Webster
//	
//	Project			:	TacWars
//
//	Last Modified	:	11/6/2013
//
//	Purpose			:	
//
//////////////////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "IEntity.h"
#include "../../SGD Wrappers/IListener.h"



struct TileM;
class AnimInfo;
class EntityObject;
class Player;
class PrecisionGauge;
class Entity : public IEntity, public IListener
{
	protected:
	enum entityType{GENERAL, BERSERKER, KNIGHT, PRIEST, RANGER};
	entityType		Type;

	enum entityState{IDLE, MOVE, ACTION, ATTACK, ABILITY, FINISH, DEAD};
	entityState		State;
public:

	//IEntity shit
	virtual void Update( float fElapsedTime );
	virtual void Render( void );
	virtual RECT GetRect( void ) const;
	virtual void HandleCollision( const IEntity* pOther );
	virtual void AddRef ( void );
	virtual void Release( void );
	virtual void HandleEvent(const CEvent* pEvent);

	Entity();
	virtual ~Entity();


	virtual int GetType() const {return Type;}
	virtual int GetStateID()const	{return State;}
	
	virtual void Move(TileM* tile);
	virtual void Attack(Entity* target);
	virtual void UseAbility();
	virtual void Capture(EntityObject* object);
	virtual void ShowMoveRange();
	virtual void ShowAttackRange();
	virtual void StartStopAnimation()	{   moveAnimation = !moveAnimation;   }
	virtual bool CanIMoveHere(TileM* tile);
	virtual bool CanIAttackHere(TileM* tile);

	
	int GetMoveRange()			const { return moveRange;		}
	int GetAttackRange()		const { return attackRange;		}
	int GetAttackDamage()		const { return attackDamage;	}
	int GetHealth()				const { return Health;			}
	int GetLoyalty()			const { return Loyalty;			}
	int GetAbilityCooldown()	const { return abilityCooldown; }
	int GetAbilityRange()		const { return abilityRange;	}
	int GetImageID()			const { return imageID;			}
	int GetPosX()				const { return posX;			}
	int GetPosY()				const { return posY;			}
	int GetMaxHP()				const { return maxHP;			}
	int GetMaxLP()				const { return maxLP;			}
	bool GethasMoved()			const { return hasMoved;		}
	bool GetHasFlag()			const { return hasFlag;			}
	bool GetIsBuffed()			const { return isBuffed;		}
	bool GetIsScared()			const { return isScared;		}
	bool GetIsNeutral()			const { return isNeutral;		}
	bool GetIsCapping()			const { return isCapping;		}
	float GetHeight()			const { return Height;			}
	float GetWidth()			const { return Width;			}
	Player* GetOwner()			const { return Owner;			}
	AnimInfo* GetAnimInfo()		const { return myInfo;			}
	PrecisionGauge* GetGauge()  const { return Gauge;           }
	void SetMoveRange			(int v	)	{	moveRange = v;		}
	void SetAttackRange			(int v	)	{	attackRange = v;	}
	void SetAttackDamage		(int v	)	{	attackDamage = v;	}
	void SetHealth				(int v	)	{	Health = v;			}
	void SetLoyalty				(int v	)	{	Loyalty = v;		}
	void SetAbilityCooldown		(int v	)	{	abilityCooldown = v;}
	void SetPosX				(int v	)	{	posX = v;			}
	void SetPosY				(int v	)	{	posY = v;			}
	void SetImgID				(int v)		{	imageID = v;		}
	void SetHasFlag				(bool v	)	{	hasFlag = v;		}
	void SetIsBuffed			(bool v	)	{	isBuffed = v;		}
	void SetIsScared			(bool v	)	{	isScared = v;		}
	void SetIsNeutral			(bool v )	{	isNeutral = v;		}
	void SetIsCapping			(bool v )	{	isCapping = v;		}
	void SetHeight				(float v)	{	Height = v;			}
	void SetWidth				(float v)	{	Width = v;			}
	void SetOwner				(Player* v)	{	Owner = v;			}
	void SetAnimInfo			(AnimInfo* v) { myInfo = v;			}
	TileM* GetOccupyingTile() {return occupyingTile;}
	void SetOccupyingTile(TileM* tile) {occupyingTile = tile;}
	void SetState               (int v) { State = (entityState)v;}
private:
	int moveRange, attackRange, attackDamage, Health, Loyalty, abilityCooldown, 
		abilityRange, imageID, posX, posY, maxHP, maxLP;
	bool hasFlag, isBuffed, isScared, isNeutral, isCapping, hasMoved, showMove, showAttack, moveAnimation;
	float Height, Width;

	unsigned int	refCount;

	AnimInfo* myInfo;
	Player* Owner;
	TileM* occupyingTile;
	PrecisionGauge* Gauge;
	RECT moveRect, attackRect;
};